home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / DTS QT Utilities.Aug-95 / DTSQTUtilities.h < prev   
Encoding:
Text File  |  1995-07-09  |  7.2 KB  |  160 lines  |  [TEXT/MPCC]

  1. /*
  2.     File:        DTSUtilities.h
  3.  
  4.     Contains:    QuickTime functions, header file definitions.
  5.  
  6.     Written by:    DTS
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.        <1>         12/17/94    khs        first file
  13.        
  14. */
  15.  
  16.  
  17. // Define that this file should only be parsed once, most dev environments know of pragma once.
  18. #pragma once
  19.  
  20.  
  21. // INCLUDES
  22. #include <Gestalt.h>
  23. #include <GestaltEqu.h>
  24. #include <TextUtils.h>
  25. #include <Errors.h>
  26. #include <SegLoad.h>
  27. #include <Printing.h>
  28. #include <Sound.h>
  29.  
  30. #include <Movies.h>
  31. #include "MoviesFormat.h"
  32. #include <Components.h>
  33. #include <QuickTimeComponents.h>
  34. #include <FixMath.h>
  35.  
  36. #include <stdio.h>
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42.  
  43. // Window size constants.
  44. enum eQTUWindowSize {
  45.     kNormalMovieSize = 1L,
  46.     kHalfMovieSize,
  47.     kDoubleMovieSize
  48. };
  49.  
  50.  
  51. // Rate constant values, Fwd = forward, Bwd = backwards.
  52. enum eQTUMovieRates {    kNoSpeed = 0x00000000,  kFwdSpeed = 0x00010000,
  53.                                         kFwdDoubleSpeed = 0x00020000, kFwdTripleSpeed = 0x00030000,    
  54.                                         kFwdQuadSpeed = 0x00040000, kFwdHalfSpeed = 0x00008000, 
  55.                                         kFwdQuarterSpeed = 0x00004000, kFwdEightspeed = 0x00002000, 
  56.                                         kBwdSpeed = 0xFFFF0000, kBwdDoubleSpeed = 0xFFFE0000, 
  57.                                         kBwdHalfSpeed = 0xFFFF8000 };
  58.  
  59.  
  60. // Constants used for QTUPrintMoviePICT.
  61. enum eQTUPICTPrinting { kPrintFrame = 1, kPrintPoster };
  62.  
  63.  
  64. // MACROS
  65. #if DEBUG
  66. static char gDebugString[256];
  67.  
  68. #define DebugAssert(condition)                                                                        \
  69.         if (condition)        NULL;                                                                            \
  70.     else                                                                                                             \
  71.     {                                                                                                                \
  72.         sprintf(gDebugString,"File: %s, Line: %d", __FILE__, __LINE__);            \
  73.         DebugStr(c2pstr(gDebugString));                                                            \
  74.     }
  75. #else
  76. #define DebugAssert(condition)        NULL
  77. #endif
  78.  
  79. #define MBSTARTTIMER() DebugStr("\pStart! `;mc starttime @ticks;g")
  80. #define MBSTOPTIMER()    DebugStr("\pElapsed time in ticks: '; @ticks - starttime")
  81.  
  82.  
  83. // ReturnIfError is a simple macro around the frequently written code line doing the same (see below)
  84. #define ReturnIfError(theError)  DebugAssert(theError == noErr);  \
  85.                                                     if(theError != noErr) return theError
  86.  
  87.  
  88. // FUNCTION PROTOTYPES
  89.  
  90.  
  91.  
  92. // MOVIE TOOLBOX FUNCTIONS
  93. pascal Boolean             QTUIsQuickTimeInstalled(void);                                                                                        // Check if QT is present.
  94.  
  95. #ifdef powerc
  96. pascal Boolean             QTUIsQuickTimeCFMInstalled(void);                                                                                // Check if QT CFM library is present.
  97. #endif // powerc
  98.  
  99. pascal long                 QTUGetQTVersion();                                                                                                        // Get QT version number.
  100. pascal Boolean             QTUAreQuickTimeMusicInstrumentsPresent(void);                                                            // Test if Musical Instrumentscomponent is present.
  101.  
  102. pascal OSErr                QTUPrerollMovie(Movie theMovie);                                                                                // Preroll Movies before Playback.
  103.  
  104. pascal Boolean             QTUFileFilter(ParmBlkPtr theParamBlock);
  105. pascal Movie             QTUGetMovie(FSSpec *theFSSpec, short *theRefNum, short *theResID);                        // Return a Movie from a file with the movie.
  106. pascal OSErr             QTUSimpleGetMovie(Movie *theMovie);                                                                        // Simpler version of querying for a movie and return it.
  107. pascal OSErr             QTUSaveMovie(Movie theMovie);                                                                                    // Save the movie (standard dialog box).
  108. pascal OSErr                QTUFlattenMovieFile(Movie theMovie, FSSpec *theFile);                                                // Takes a movie and a file and flattens the movie into the file.
  109. pascal OSErr                QTUPrintMoviePICT(Movie theMovie, short x, short y, long PICTUsed);                           // Print the movie poster.
  110. pascal OSErr                QTUCalculateMovieMemorySize(Movie theMovie, long *theSize);                                    // Return the size of the movie in memory.
  111. pascal OSErr                QTULoadWholeMovieToRAM(Movie theMovie);                                                                // Load the whole movie to RAM.
  112. pascal OSErr                QTUPlayMovieSound(Movie theMovie);                                                                            // Play the movie sound track using the snd resource.
  113. pascal OSErr                QTUDrawVideoFrameAtTime(Movie theMovie, TimeValue atTime);                                    // Draw a movie frame at specified time.
  114. pascal OSErr             QTUScrollToNextVideoSample(Movie theMovie, TimeValue fromTimePoint, 
  115.                                                                                 TimeValue toTimePoint);                                                // Do a visible scroll from one video frame to another.
  116.  
  117. pascal OSErr             QTUGetStartPointOfFirstVideoSample(Movie theMovie,TimeValue *startPoint);                // Get time value of first sample in the movie.
  118.  
  119. // TRACK & MEDIA
  120. pascal Boolean             QTUMediaTypeInTrack(Movie theMovie, OSType theMediaType);                                    // Check if a Media type is present in a track of a movie.
  121. pascal OSErr                QTUGetTrackRect(Track theTrack, Rect *theRect);                                                        // Get the track rect of a possible video track
  122. pascal short                 QTUGetVideoMediaPixelDepth(Media theMedia, short index);                                            // Get the pixel depth of a video media.
  123. pascal long                QTUCountMediaSamples(Movie theMovie, OSType theMediaType);                                    // Count frames in a movie based on defined media.
  124. pascal TimeValue          QTUGetDurationOfFirstMovieSample(Movie theMovie, OSType theMediaType)    ;                // Get duration of first sample in the track
  125. pascal OSErr             QTUCountMaxSoundRate(Movie theMovie,long *theMaxSoundRate);                                // Return max sound rate from a sound track in a movie.
  126. pascal long                 QTUGetMovieFrameCount(Movie theMovie, long theFrameRate);                                        // Return frames based on frame rate and movie.
  127. pascal OSErr             QTUCopySoundTracks(Movie theSrcMovie, Movie theDestMovie);                                    // Copy sound tracks from source movie to destination movie
  128.  
  129.  
  130. // IMAGE COMPRESSION MANAGER
  131. Boolean                     QTUHasCodecLossLessQuality(CodecType theCodec, short thePixelDepth);                        // Test if a codec has lossless spatial compression.
  132.  
  133.  
  134. // MOVIE CONTROLLER FUNCTIONS
  135. pascal OSErr             QTUPlayMovieWithMC(MovieController mc);                                                                    // Play the movie using the movie controllers.
  136. pascal OSErr              QTUDoIgnoreMCDrags(MovieController  mc);                                                                    // ignore Drag-and-Drop functionality.
  137. pascal Boolean            QTUPointInMC(MovieController mc, WindowRef theWindow, Point where);                    // Check if a point is inside the movie controller rect.
  138. pascal OSErr             QTUSelectAllMovie(MovieController mc);                                                                        // Select the whole time frame from a movie with the mc.
  139. pascal Boolean             QTUResizeMCActionFilter(MovieController mc, short action, void *params, long refCon);
  140. pascal OSErr             QTUResizeMCWindow(MovieController mc, WindowPtr theWindow, long theMovieSize,  Rect originalSize);
  141.  
  142. pascal OSErr                QTUMCSetMovieRate(MovieController mc, long theRate);                                                // Set movie rate using movie controller.
  143.  
  144.  
  145. // SEQUENCE GRABBER FUNCTIONS
  146. pascal SeqGrabComponent QTUCreateSequenceGrabber(WindowPtr theWindow);                                                // Create a sequence grabber instance.
  147. pascal OSErr                     QTUCreateSGGrabChannels(SeqGrabComponent s, const Rect *theBounds, 
  148.                                             long theUsage, SGChannel *theVideoChannel, SGChannel *theSoundChannel);         // Create sequence grabber channels.
  149. pascal Boolean                     QTUDoesVDIGReceiveVideo(SeqGrabComponent s);                                                    // Do we have live incoming video?
  150. pascal OSErr                     QTUChangeSGWindowSize(SeqGrabComponent s,SGChannel videoChannel,                 // Change the window size of Sequence Grabber window
  151.                                             WindowPtr theWindow, long width, long height);
  152.  
  153. // COMPONENT FUNCTIONS
  154. pascal Component         QTUDoGetComponent(OSType theComponentType, OSType theSpecificComponent);
  155. pascal Boolean             QTUHasComponentType(OSType theComponentType, OSType theSpecificComponent);
  156.  
  157.  
  158. #ifdef __cplusplus
  159. }
  160. #endif